1 using System;
2 using System.Collections.Generic;
3 using System.ComponentModel;
4 using System.Drawing;
5 using System.Data;
6 using System.Linq;
7 using System.Text;
8 using System.Threading.Tasks;
9 using System.Windows.Forms;
10
11 namespace SoftQuanLyNhaHang.Controllers
12 {
13 class DonViTinhCtrl
14 {
15
16 // Method Add
17 public static int InsertDonViTinh(string _maDonViTinh, string _tenDonViTinh, int _viTri, int _trangThai)
18 {
19 try
20 {
21 Models.DonViTinhMod _donViTinh = new Models.DonViTinhMod(_maDonViTinh, _tenDonViTinh, _viTri, _trangThai);
22 return _donViTinh.InsertDonViTinh();
23 }
24 catch
25 {
26 return 0;
27 }
28 }
29
30 // Method Update
31 public static int UpdateDonViTinh(int _idDonViTinh, string _maDonViTinh, string _tenDonViTinh, int _viTri, int _trangThai)
32 {
33 try
34 {
35 Models.DonViTinhMod _donViTinh = new Models.DonViTinhMod(_idDonViTinh, _maDonViTinh, _tenDonViTinh, _viTri, _trangThai);
36 return _donViTinh.UpdateDonViTinh();
37 }
38 catch
39 {
40 return 0;
41 }
42
43 }
44
45 // Method Delete
46 public static int DeleteDonViTinh(int _idDonViTinh)
47 {
48 try
49 {
50 Models.DonViTinhMod _donViTinh = new Models.DonViTinhMod(_idDonViTinh);
51 return _donViTinh.DeleteDonViTinh();
52 }
53 catch
54 {
55 return 0;
56 }
57 }
58
59
60 //Lây điểm tích lũy theo sdt khách hàng
61 public static DataSet FillDataSetDonViTinh_GetDanhSach()
62 {
63 try
64 {
65 Models.DonViTinhMod donvitinh = new Models.DonViTinhMod();
66 return donvitinh.FillDataSetDonViTinh_GetDanhSach();
67
68 }
69 catch
70 {
71 return null;
72 }
73 }
74
75 //hiển thị đơn vị tính trong combobox
76 public static DataSet FillDataSetDonViTinh()
77 {
78 try
79 {
80 Models.DonViTinhMod donvitinh = new Models.DonViTinhMod();
81 return donvitinh.FillDataSetDonViTinh();
82
83 }
84 catch
85 {
86 return null;
87 }
88 }
89
90 public static DataSet FillDataSet_spTblDonViTinh_Search(int _pageSize, int _pageIndex)
91 {
92 try
93 {
94 Models.DonViTinhMod donvitinh = new Models.DonViTinhMod(_pageSize, _pageIndex);
95 return donvitinh.FillDataSet_spTblDonViTinh_Search();
96
97 }
98 catch
99 {
100 return null;
101 }
102 }
103
104
105
106
107 }
108 }